# Date created:         18 March 2011
# Whom:                 jashank/tigersharke
#
# $FreeBSD$
#

PORTNAME=       pyside
DISTVERSIONPREFIX=-qt4
DISTVERSION=    1.0.8
CATEGORIES=     devel x11-toolkits python
MASTER_SITES=   http://www.pyside.org/files/
PKGNAMESUFFIX=  -qt4
DISTNAME=       pyside-qt4.7+${DISTVERSION}

MAINTAINER=     jashankj@pondr.net
COMMENT=        Alternate Python bindings to Qt4

BUILD_DEPENDS+=	generatorrunner>=0.6.6:${PORTSDIR}/devel/generatorrunner
BUILD_DEPENDS+=	shiboken>=1.0.0:${PORTSDIR}/devel/shiboken
BUILD_DEPENDS+=	sphinx-build:${PORTSDIR}/textproc/py-sphinx

#BUILD_DEPENDS+=	qt4-gui:${PORTSDIR}/x11-toolkits/qt4-gui
#BUILD_DEPENDS+=	graphviz:${PORTSDIR}/graphics/graphviz

USE_BZIP2=      yes
USE_CMAKE=      yes
USE_DOS2UNIX=   yes
CMAKE_OUTSOURCE=yes

# This works to 'avoid the protected hack'
#CMAKE_ARGS+=	-DAVOID_PROTECTED_HACK=true

CMAKE_ARGS+=	-DQT_SRC_DIR=${PORTSDIR}/devel/qt4

USE_QT_VER=     4

QT_COMPONENTS=	accessible \
		clucene codecs-cn codecs-jp codecs-kr codecs-tw corelib \
		dbus declarative designer \
		graphicssystems-opengl gui help \
		iconengines imageformats \
		multimedia network opengl \
		phonon \
		qt3support qtestlib \
		script scripttools sql sql-mysql \
		sql-odbc sql-pgsql sql-sqlite2 svg \
		webkit xml xmlpatterns

USE_GL=		glu glw glew gl linux
USE_DOS2UNIX=	yes

USE_LDCONFIG=   yes

OPTIONS=        WITH_NLS "Enable support for Gettext" Off \
		USE_XVFB "Hide QtGui test windows" Off \
		BUILD_TESTS "Build tests" On \
		ENABLE_VERSION_SUFFIX "Allow multiple versions" Off \
		ENABLE_GCC_OPTIMIZATION "Library size and performance" Off

.include <bsd.port.options.mk>

.if defined(WITH_NLS)
USE_GETTEXT=	yes
USE_ICONV=	yes
PLIST_SUB+=	NLS=""
.else
CONFIGURE_ARGS+=--disable-nls
PLIST_SUB+=	NLS="@comment "
.endif

.if defined(USE_XVFB)
USE_XVFB=true
.else
USE_XVFB=""
.endif

.if defined(BUILD_TESTS)
BUILD_TESTS=true
.else
BUILD_TESTS=""
.endif

.if defined(ENABLE_VERSION_SUFFIX)
ENABLE_VERSION_SUFFIX=true
.else
ENABLE_VERSION_SUFFIX=""
.endif

.if defined(ENABLE_GCC_OPTIMIZATION)
ENABLE_GCC_OPTIMIZATION=true
.else
ENABLE_GCC_OPTIMIZATION=""
.endif

# post-extract:
#	${REINPLACE_CMD} 's|/pkgconfig|/libdata/pkgconfig|g' ${WRKSRC}/data/CMakeLists.txt
#	${REINPLACE_CMD} 's|LIB_INSTALL_DIR|ArthurDent|g' ${WRKSRC}/data/CMakeLists.txt
#	${REINPLACE_CMD} 's|/cmake/ApiExtractor-|/share/cmake/Modules|g' ${WRKSRC}/data/CMakeLists.txt
#	${REINPLACE_CMD} 's|apiextractor_VERSION|ZaphodBeeblebrox|g' ${WRKSRC}/data/CMakeLists.txt

pre-configure:
	${MKDIR} ${CONFIGURE_WRKSRC}/PySide/QtOpenGL/PySide/QtOpenGL/GL/
	${CP} ${LOCALBASE}/include/GL/*.h ${CONFIGURE_WRKSRC}/PySide/QtOpenGL/PySide/QtOpenGL/GL

.include <bsd.port.mk>
